import java.lang.InterruptedException;

public class loop1 extends Loop {
    loop1(int name) {
        super(name);
    }

    public void loopMain()
            throws InterruptedException {
        int answer;
        Main.utility.waitPrint(200, 100, "\"今天是5月15日，天气晴转阴，10摄氏度......\"广播中传出了天气预报", true);
        Main.utility.waitPrint(200, 100, "你没有兴趣听天气预报，于是你便打算出去散散步", true);
        Main.utility.waitPrint(200, 100, "门外还是和往常一样，可是空无一人", true);
        Main.utility.waitPrint(200, 100, "你开始害怕起来。。。。。。", true);
        answer = Main.utility.question("回家", "出小区看看");
        if (answer == 1) {
            Main.utility.waitPrint(200, 100, "你回到家里，发现了一个不太对劲的地方，客厅里，有一个折跃门", true);
            answer = Main.utility.question("跳入折跃门（just do it!）", "还是出小区看看吧");
            if (answer == 1) {
                //进入第二循环
            }
            else if (answer == 2) {
                Main.utility.waitPrint(200, 100, "出了小区，你看了看周围，不知道那个黑影去哪里了", true);
                outCity();
            }
        }
        Main.utility.waitPrint(200, 100, "到了小区门口，门卫室里没有一个人", true);
        Main.utility.waitPrint(200, 100, "此时，你遇到了一个黑影，心里十分害怕", true);
        Main.utility.waitPrint(200, 100, "你想起了那个广播", true);
        outCity();
    }

    private void outCity() throws InterruptedException {
        int answer;
        answer = Main.utility.question("去江边散散步", "沿长江路散散步");
        if (answer == 1) {
            Main.utility.waitPrint(200, 100, "你突然发现，游乐场没了，只剩下一条路延伸向前方", true);
            Main.utility.waitPrint(200, 100, "你疑惑不解，想：游乐场又没有倒闭，怎么会空无一人呢？", true);
            answer = Main.utility.question("继续往前走", "回小区看看吧");
            if (answer == 1) {
                //进入第二循环
                return;
            }
            Main.utility.waitPrint(200, 100, "回头一看，一个黑影闪现在你的面前。。。。。。随后，那个人一剑砍下了你的头", true);
            Main.utility.waitPrint(200, 100, "你失败了，返回第一循环", true);
            loopMain();
            return;
        }
        Main.utility.waitPrint(200, 100, "此时，你发现你得背后凉飕飕的", true);
        Main.utility.waitPrint(200, 100, "你回头一看，神秘人在你的背后", true);
        answer = Main.utility.question("自尽结束一切", "和那个黑影搏斗（90%概率获胜）");
        if (answer == 1) {
            Main.utility.waitPrint(200, 100, "你拿起那个黑影的剑，砍下了自己的头", true);
            Main.utility.waitPrint(200, 100, "没想到，你又回到了第一循环", true);
            loopMain();
            return;
        }
        int rand = ((int) (100 * Math.random())) % 10;
        if (rand==1||rand==2||rand==3||rand==4||rand==6||rand==7||rand==8||rand==9) {
            Main.utility.waitPrint(200, 100, "你的技术还是那么高超，把那个黑影打倒在地", true);
            Main.utility.waitPrint(200, 100, "你完成了第2个结局", true);
            Main.utility.waitPrint(200, 100, "将为您检测是否通关", true);
            Main.global.setEnding2(true);
            Main.end.EndText();
            return;
        }
        else{
            Main.utility.waitPrint(200, 100, "你失败了，返回第一循环", true);
            loopMain();
            return;
        }
    }
}
